﻿<%@ Page Language="C#" AutoEventWireup="true"  CodeBehind="UserGrant.aspx.cs" 
Title="用户权限设置" MasterPageFile="~/default.Master" Inherits="Webcar.SysManage.UserGrant" %>

<%@ Register Src="../Controls/NaviBar.ascx" TagName="NaviBar" TagPrefix="uc1" %>



<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <script language = "javaScript" src="../JavaScript/TreeView2.js" type="text/javascript"></script>
    <uc1:NaviBar ID="NaviBar1" runat="server" />
    <div id = "UserGrant">
    <div class="div_taobao_pic">
            <asp:Label ID="lblHeader" runat="server" Text="">
            </asp:Label>
        </div>
    <div class="role">
        
        <asp:Repeater ID="Repeater1" runat="server" >
            <ItemTemplate>
            <div class="C1">
              &nbsp;&nbsp;<asp:Image ID="Image1" runat="server" ImageUrl="~/App_Themes/Default/image2/users_icon.gif" />
              <br />
              <asp:Label ID="lblRoleID" runat="server"  Visible = "false" Text='<%# Bind("group_code") %>'></asp:Label>
              
              <asp:Label ID="lblRoleName" runat="server" Text='<%# Bind("group_note") %>'></asp:Label>
              <asp:CheckBox ID="cbGrant" runat="server" /></div>
            </ItemTemplate>
        </asp:Repeater>
    </div>
    
    <table width="100%">
    <tr>
    <td class="filter" style="vertical-align:top;border: 1px solid #006699; margin-right:1px;">
        <div>
        <div  class="div_taobao_pic">
        设置用户可操作的单位：
        </div>
        <asp:TreeView ID="tv" OnClick="OnTreeNodeChecked()"  runat="server" ImageSet="Msdn" ShowCheckBoxes="All" Width="30%" ExpandDepth="0">
                </asp:TreeView>
        </div>
    </td>
    <td style=" vertical-align:top">
    <div>
        <div class="div_taobao_pic">
        设置用户的权限明细：
        </div>
        <asp:GridView ID="GridView1" Width="100%" runat="server" SkinID="gridviewSkin"  AutoGenerateColumns="False" ShowHeader="False"  GridLines="Horizontal" DataKeyNames="purviewid">
               <Columns>
                    <asp:TemplateField>
                   
                   <ItemTemplate>
                       &nbsp;<asp:Label ID="Label2" runat="server" Text='<%# Bind("module_name") %>'></asp:Label>
                   </ItemTemplate>
               </asp:TemplateField>
                   <asp:TemplateField>
                      
                       <ItemStyle Height="20px" Width="50%" VerticalAlign="Middle" />
                       <ItemTemplate>
                       <img alt="" src="../App_Themes/Default/image2/up.gif" />
                           <asp:Label ID="Label1" runat="server" Text='<%# Bind("purview_name") %>'></asp:Label>
                       </ItemTemplate>
                   </asp:TemplateField>
                   <asp:TemplateField>
                       
                       <ItemTemplate>
                           <asp:RadioButton ID="rbYes" GroupName="1" runat="server" Text ="允许"/>
                           <asp:RadioButton ID="rbNo" GroupName="1" runat="server"  Text ="拒绝"/>
                           
                       </ItemTemplate>
                   </asp:TemplateField>
                   
                   <asp:TemplateField>
                        <ItemTemplate>
                        <asp:Label ID="lblMsg" runat="server" Text="" ForeColor="red"></asp:Label>
                        </ItemTemplate>
                   </asp:TemplateField>
                   
               </Columns>
           </asp:GridView>
           <hr class="line_blue" />
           <div class="C2">
            <asp:Button ID="Button1" runat="server" Text="保存" SkinID = "default_button" Width="64px" OnClick="Button1_Click" UseSubmitBehavior = "false" /></div>
       </div>
    </td>
    
    </tr>
    </table>
    
    
    
  </div>

<script language ='javascript' type='text/javascript'> 

function OnTreeNodeChecked()
{
    
    // 是否级联选择
    var element = window.event.srcElement;
    if (!IsCheckBox(element))
        return;
    
    var isChecked = element.checked;            
    var tree = TV2_GetTreeById("<%=treeid%>");
    var node = TV2_GetNode(tree,element);      
    
    TV2_SetChildNodesCheckStatus(node,isChecked);  
    
    var parent = TV2_GetParentNode(tree,node);
    TV2_NodeOnChildNodeCheckedChanged(tree,parent,isChecked);       
}
</script>
 </asp:Content>